/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_18347982357336_871231';

  // add your middleware config here
  // config.middleware = [
  //   'notfound'
  // ];

  config.cors = {
    origin: 'http://localhost:8081',
    allowMethods: 'HEAD,POST,GET,PUT,DELETE,PATCH,OPTIONS'
  }

  config.security = {
    csrf: {
      enable: false
    }
  }

  config.jwt = {
    secret: 'qweasd789456'
  }

  config.sequelize = {
    username: "root",
    password: "aoyou123",
    database: "egg_development",
    host: "127.0.0.1",
    dialect: "mysql",
    pool:{
      max: 5,
      min: 0,
      acquire: 30000,
      idle: 10000
    },
    timezone: '+08:00'
  }

  config.io = {
    init: {},
    namespace: {
      '/public': {
        connectionMiddleware: [],
        packetMiddleware: []
      },
      '/private': {
        connectionMiddleware: [],
        packetMiddleware: []
      }
    }
  }

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
